<?php

class esb_api{

	/**
	 * 接收执行方法，根据店铺编号取出店铺类型（taobao、paipai）
	 * @param arr $result 方法(method：store.items.quantity.list.update ) 店铺编号(shop_id:9da579eab3662cc0086b89cb65b23198)
	 *  node_type 节点类型 调用对应接口
	 *  method   调用对应接口的方法
	 */
	function router($result){

 		$method = $_POST['method'];
 		$node_type= $_POST['node_type'];
 		
		//$_GET=$result;
		//$_POST=$result;
		//$method = $_GET['method'];
		$node_type= $_POST['node_type'];
		//kernel::log("esb method:".$method);
		kernel::log("esb param:".serialize($_POST));
		$method=str_replace(".", "_", $method);
		
		$classArr=array(
				"shopex_b2c"=>"qbbcom",
				"qinqinbaby"=>"qbbcom",
				"taobao"=>"taobao",
				"gome"=>"gome",
				"public"=>"public",
				
				);
		//var_dump($_GET);var_dump($result);
		//判断接口类型taobao、shopex、paipai
		$node_type =$classArr[$node_type];
		$class =   'esb_rpc_request_'.$node_type.'_api';
		$rtJson = kernel::single($class)->$method($_POST);
		
		
		//kernel::log("开放api".serialize($_POST));
		//$orderObj = new esb_taobao_trade();
		//echo 'sssss';
		
		echo $rtJson;

	}

}